Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated getPastTimeString with getTimeSpanString #1007

Merged

Conversation

MarkEWaite
Copy link
Contributor

Replace deprecated getPastTimeString with getTimeSpanString

Replaced with OpenRewrite command:

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
      -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-jenkins:RELEASE \
      -Drewrite.activeRecipes=org.openrewrite.jenkins.migrate.hudson.UtilGetPastTimeStringToGetTimeSpanString

jenkinsci/jenkins#4174 deprecates the API in a 2019 release of Jenkins core.

https://javadoc.jenkins.io/hudson/Util.html#getPastTimeString(long) declares it deprecated.

Testing done

Confirmed automated tests continue to pass with the change and that the modified line is executed in the automated tests.

Did not confirm that there is an assertion specifically targeting the getWhenDisabledBySystemString, but the deprecation message says that the API calls are equivalent.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

Replaced with OpenRewrite command:

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
      -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-jenkins:RELEASE \
      -Drewrite.activeRecipes=org.openrewrite.jenkins.migrate.hudson.UtilGetPastTimeStringToGetTimeSpanString

jenkinsci/jenkins#4174 deprecates the API in a
2019 release of Jenkins core.

https://javadoc.jenkins.io/hudson/Util.html#getPastTimeString(long)
declares it deprecated.
@MarkEWaite MarkEWaite requested a review from a team as a code owner August 27, 2023 11:03
@MarkEWaite MarkEWaite added the chore Reduce effort required to maintain label Aug 27, 2023
@MarkEWaite MarkEWaite merged commit 38830da into jenkinsci:master Aug 27, 2023
17 checks passed
@MarkEWaite MarkEWaite deleted the replace-deprecated-getPastTimeString branch August 27, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Reduce effort required to maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant